using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMTalonarios
    {
        public BMTalonarios(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        DATalonarios daTalonarios = new DATalonarios();
        List<Talonarios> listaTalonarios = new List<Talonarios>();

        #region BMTalonariosGetAll
        public List<Talonarios> BMTalonariosGetAll()
        {
            try
            {
                listaTalonarios = daTalonarios.DATalonariosGetAll(connection);
                return listaTalonarios;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMTalonariosUpdate
        public void BMTalonariosUpdate(Talonarios talonario)
        {
            try
            {
                daTalonarios.DaTalonariosUpdate(connection, talonario);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}

